﻿using System;
using VisualWip.Core.Interfaces;

namespace VisualWip.Core.Columns
{
    public class WorkDoingDoneColumn : WorkDualQueryColumnBase
    {
        private readonly IWorkItemProviderFactory _workItemProviderFactory;

        public WorkDoingDoneColumn(IWorkItemProviderFactory workItemProviderFactory) : base(workItemProviderFactory)
        {
            _workItemProviderFactory = workItemProviderFactory;
        }

        public override IQuery Query
        {
            get { throw new NotImplementedException(); }
        }

        public override int GetWorkInProgressLimit()
        {
            throw new NotImplementedException();
        }

        public WorkInProgressGroupColumn GetWorkInProgressGroupSettings()
        {
            return Build(new WorkInProgressGroupColumn(_workItemProviderFactory));
        }

        public WorkDoingColumn GetWorkItemDoingColumnSetting()
        {
            WorkDoingColumn columnSetting = Build(new WorkDoingColumn(_workItemProviderFactory));
            columnSetting.ColumnName = "Doing";
            columnSetting.ShowWorkInProgressLimit = false;
            return columnSetting;
        }

        public WorkDoneColumn GetWorkItemDoneColumnSetting()
        {
            WorkDoneColumn columnSetting = Build(new WorkDoneColumn(_workItemProviderFactory));
            columnSetting.ColumnName = "Done";
            columnSetting.ShowWorkInProgressLimit = false;
            return columnSetting;
        }

        private TColumn Build<TColumn>(TColumn column) where TColumn : WorkDualQueryColumnBase
        {
            column.ColumnName = ColumnName;
            column.PositionX = PositionX;
            column.PositionY = PositionY;
            column.Width = Width;
            column.Height = Height;
            column.ZIndex = ZIndex;
            column.WindowName = WindowName;
            column.TotalWorkInProgressLimit = TotalWorkInProgressLimit;
            column.WorkItemSize = WorkItemSize;
            column.FirstQuery = FirstQuery;
            column.SecondQuery = SecondQuery;
            column.WorkItemProviderName = WorkItemProviderName;
            return column;
        }
    }
}